package com.ct.lotterysystem2.common.filter;

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.filter.Filter;
import ch.qos.logback.core.spi.FilterReply;

public class InfoLevelFilter extends Filter<ILoggingEvent> {


    /**
     * 日志过滤器
     * 只允许 INFO 级别的日志被输出到目标（如控制台、文件等），其他级别的日志（如 DEBUG、ERROR）将被忽略。
     *
     * @param iLoggingEvent
     * @return
     */
    @Override
    public FilterReply decide(ILoggingEvent iLoggingEvent) {
        if (iLoggingEvent.getLevel().toInt() == Level.INFO.toInt()){
            return FilterReply.ACCEPT;
        }
        return FilterReply.DENY;
    }
}
